﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Configuration;

namespace ZetaPrints.ZetaClient.Shared.Manipulator
{
    public static class ZetaDateTimeStringManipulator
    {
        /// <summary>
        /// Getting a date on this format 2007-11-14T21:24:29.620 and creating a DateTime entry
        /// for it
        /// </summary>
        /// <param name="zetaStringDateTime"></param>
        /// <returns></returns>
        public static DateTime ToDateTime(string zetaStringDateTime)
        {
            /// separate the date time so we can remove the T from the middle of it.
            string date = zetaStringDateTime.Substring(0, zetaStringDateTime.IndexOf('T'));
            string time = zetaStringDateTime.Substring(zetaStringDateTime.IndexOf('T') + 1);

            /// parse and return the date
            return DateTime.Parse(date + " " + time);
        }
    }
}
